package com.juyu.miliao.api.controller.activity;

import com.juyu.miliao.api.service.SummerActivityStatisticService;
import com.juyu.miliao.common.domain.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 活动统计
 * @author xuanqicheng
 */
@RestController
@RequestMapping("/activity/statistic")
public class ActivityStatisticController {

    @Autowired
    private SummerActivityStatisticService summerActivityStatisticService;
    /**
     * 夏季活动统计
     * type ：1 寻寻页面的悬浮广告位，2：社区广告位，3：参与暑假活动
     * @param type
     */
    @GetMapping("/summer/{type}")
    public void getActivityStatistic(Authentication token, @PathVariable("type") Integer type){
        if(type == null){
            type =0;
        }
        Subject subject = (Subject) token.getPrincipal();

        summerActivityStatisticService.getStatisticsSummerActivity(type,subject.getId());

    }
}
